package 学生评教管理系统;

import java.util.ArrayList;
import java.util.Scanner;

import static 学生评教管理系统.Operator.inputEvaluate;

public class Main {

    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<Student>();
        System.out.println("\t\t教师授课评教系统");
        System.out.println("1、查询所有学生列表\t2、添加学生\t3、修改学生\t4、删除操作\t5、录入课程\t6、显示课程\t7、删除课程\t8、录入教师"
                + "\t9、显示教师\t10、教师排课\t11、查询教师与课程号的对应信息\t12学生登录并授课评价\t13、退出");
        Student[] students = null;
        Course courses[] = null;
        Teacher teachers[] = null;
        Student student[] = null;
        Operator operator = new Operator();
        Scanner scan = new Scanner(System.in);
        itcase:
        while (true) {
            //显示系统主菜单
            System.out.println("请选择您的功能:");
            int choice = scan.nextInt();// 接收用户的选择
            switch (choice) {
                case 1:              // 输入学生信息
                    //执行查询所有学生列表的操作
                    operator.showAllStudent(list);
                    break;
                case 2:
                    //添加学生
                    operator.addStudents(list);
                    break;
                case 3:
                    //修改学生
                    operator.reviseStudent(list);
                    break;
                case 4:
                    //删除学生
                    operator.delStudent(list);
                    break;
                case 5://录入课程
                    System.out.println("请输入课程数：");
                    int n = scan.nextInt();
                    courses = new Course[n];
                    operator.addCourses(courses);
                    break;
                case 6: // 显示课程
                    operator.displayCourses(courses);
                    break;
                case 7://删除课程
                    operator.delCourses(courses);
                    break;
                case 8: // 录入教师
                    System.out.println("请输入教师数：");
                    n = scan.nextInt();
                    teachers = new Teacher[n];
                    operator.addTeachers(teachers);
                    break;
                case 9:// 显示教师
                    operator.displayTeachers(teachers);
                    break;
                case 10:// 教师排课
                    operator.assignTeachCourses(teachers, courses);
                    break;

                case 11://查询教师与课程号的对应信息
                    operator.showCourses(teachers, courses);
                    break;
                case 12:// 学生登录并授课评价
                    Scanner scanf = new Scanner(System.in);
                    System.out.println("请输入您的学号:");
                    int studentId = scanf.nextInt();
                    System.out.println("请输入您的密码：");
                    int passworld = scanf.nextInt();

                    if (inputEvaluate(studentId, passworld, list)) {
                        System.out.println("您已经可以对老师进行评教！");
                        operator.evaluate(teachers);
                    } else {
                        System.out.println("学号或密码不匹配,登录错误！");
                    }
                    break;
                case 13:// 退出
                    System.out.println("退出学生评教管理系统！");
                    break itcase;
                default://输入非选择项
                    System.out.println("非法命令！");
            }
        }
    }
}